<?php
require $_SERVER['DOCUMENT_ROOT'].'/../_core/common.php';

//权限验证
if( Role::init() == false ){
	exit('没有权限');
}

require $_SERVER['DOCUMENT_ROOT'].'/../_interface/pages.php';
require $_SERVER['DOCUMENT_ROOT'].'/../_interface/name.php';

$db = new DB('news');

$category_id = 1;

$pageSize = 20;//每页显示条数
$page = isset($_GET['page']) ? intval($_GET['page']): 1;

$total_sql = 'select title_id from news where is_del=2';
$total = $db->query($total_sql)->getCount();

//分页html
$page_html = Pages::page($page, $total, $pageSize, '/admin/news/news_recover.php');

$news_sql = 'select title_id,title,edit_uid,updated,is_publish,publish_time,index_top,orders,empty_id from news where is_del=2 order by index_top desc,orders desc,updated desc limit '.(($page-1)*$pageSize).','.$pageSize;
$news_rs = @$db->query($news_sql)->getAll();
$pagenav;

foreach( $news_rs as $key=>$val ){
	//查询姓名
	$del_username = Name::get_username($db, $val['edit_uid']);
	$news_rs[$key]['del_username'] = $del_username;
}

//记录动作日志
Log::logs_articles(-1, 1);

//包含模板
require template('admin/news/news_recover');